import request from '@/utils/request'

// 查询排班列表
export function listSchedule(query) {
  return request({
    url: '/manage/schedule/list',
    method: 'get',
    params: query
  })
}

// 查询周排班表
export function getWeekSchedule(query) {
  return request({
    url: '/manage/schedule/week',
    method: 'get',
    params: query
  })
}

// 查询排班详细
export function getSchedule(scheduleId) {
  return request({
    url: '/manage/schedule/' + scheduleId,
    method: 'get'
  })
}

// 新增排班
export function addSchedule(data) {
  return request({
    url: '/manage/schedule',
    method: 'post',
    data: data
  })
}

// 修改排班
export function updateSchedule(data) {
  return request({
    url: '/manage/schedule',
    method: 'put',
    data: data
  })
}

// 删除排班
export function delSchedule(scheduleId) {
  return request({
    url: '/manage/schedule/' + scheduleId,
    method: 'delete'
  })
}

// 批量保存排班表
export function batchSaveSchedule(data) {
  return request({
    url: '/manage/schedule/batch',
    method: 'post',
    data: data
  })
}

// 复制上周排班
export function copyLastWeekSchedule(data) {
  return request({
    url: '/manage/schedule/copyLastWeek',
    method: 'post',
    data: data
  })
}

// 清空当前排班
export function clearCurrentSchedule(data) {
  return request({
    url: '/manage/schedule/clear',
    method: 'delete',
    data: data
  })
}

// 检查排班冲突
export function checkScheduleConflict(data) {
  return request({
    url: '/manage/schedule/checkConflict',
    method: 'post',
    data: data
  })
}

// 查询可用员工列表
export function getAvailableEmployees(query) {
  return request({
    url: '/manage/schedule/employees',
    method: 'get',
    params: query
  })
}

// 查询窗口列表
export function getWindowList(query) {
  return request({
    url: '/manage/schedule/windows',
    method: 'get',
    params: query
  })
}

// 导出排班表
export function exportSchedule(query) {
  return request({
    url: '/manage/schedule/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 获取排班统计信息
export function getScheduleStatistics(query) {
  return request({
    url: '/manage/schedule/statistics',
    method: 'get',
    params: query
  })
}
